@{
    ViewBag.Title = "资源管理";
}
@section head{
   <link href="@Url.Content("~/Content/Images/UploadIcons/icons.css")" rel="stylesheet" type="text/css" />
   <script type="text/javascript">
       $(document).ready(function () {

       });
       function on_close(key) {
           $('#details').treegrid('reload');
       }
       function onDeleteData() {
           $('#details').treegrid('reload');
       }
       function aformat(value, row, index) {
           var ret = null;
           if (value) {
               ret = hrefformat(value, value, row.text, true, row.iconCls);
           }
           return ret;
       }

       function cmdformat(value, row, index) {
           var id = row.id;
           return '<a href="javascript:show_fullscreen_dialog(serverUrl.edit + \'?id=\' + \'' + id + '\',on_close,\'edit\')">修改</a>&nbsp; <a href="javascript:Del(\'' + id + '\',onDeleteData)">删除</a>';
       }

       function typeformat(value, row, index) {
          var ResourceType=@Html.Raw(new OA.Mvc3.Controllers.DictionaryController().GetChilds("ResourceType"));
          return dicformat(ResourceType,value);
       }

       function bformat(value, row, index) {
            if(row.type!=3) return value ? '是' : '否';
        }

   </script>
}
@section body{
<body>
<div class="easyui-layout" data-options="fit:true">
    <div region="north" border="false">
        <div class="navigation">@ViewBag.CurrentPath</div>
        <div class="tools_box">
	        <div class="tools_bar">
                <div class="left">
                   <a href="javascript:show_fullscreen_dialog(serverUrl.add,on_close,'add')" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true ">添加</a>  
                   <a href="javascript:DeleteSelecteds($('#details').treegrid('getSelections'),'id',onDeleteData)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true">批量删除</a>
                </div>
            </div>
        </div>
    </div> 
    <div region="center" border="false">
        <table class="easyui-treegrid" id="details" data-options="fit:true,rownumbers:true,singleSelect:false,
          pagination:false,border:true,idField:'id',treeField: 'text',onBeforeLoad:treeLoadData">
           <thead data-options="frozen:true"> 
              <tr>
                   <th data-options="field:'id',checkbox:true"></th>
                   <th data-options="field:'text',width:180">资源名称</th>
                   <th data-options="field:'code',width:150">资源编号</th>
              </tr>
           </thead>
           <thead>  
               <tr>  
                   <th data-options="field:'type',width:80,formatter:typeformat">类型</th>
                   <th data-options="field:'HrefUrl',width:200,formatter:aformat">连接地址</th>
                   <th data-options="field:'IsShow',width:80,align:'center',formatter:bformat">是否显示</th>
                   <th data-options="field:'Sort',width:80">排序</th>
                   <th data-options="field:'cmd',width:100,align:'center',formatter:cmdformat">操作</th>
               </tr>  
           </thead>  
        </table>
    </div>
</div>
</body>
}